package com.guigu.lzw.controller;

import com.guigu.lzw.service.*;
import com.guigu.pojo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class Setmeals {
    @Autowired
    MakeService ms;
    @Autowired
    VipService vs;
    @Autowired
    PsychologyjgService ps;
    @Autowired
    PhysicaljgService phs;
    @Autowired
    InterveneService is;
    @Autowired
    SetmealService ss;
    @ResponseBody
    @RequestMapping("sevenMake")
    public int sevenMake(@RequestBody Make make){
        Vip vip = new Vip();
        vip.setCard(make.getCertificate());
        Vip query = vs.query(vip);
        make.setVipid(query.getVipid());
        return ms.seven(make);
        }

    @ResponseBody
    @RequestMapping("findMake")
    public List<Make> findMake(@RequestBody Make make){
        return ms.findAll(make);
    }
    @ResponseBody
    @RequestMapping("findPhysicaljg")
    public List<Physicaljg> findPhysicaljg(@RequestBody Physicaljg physicaljg){
        return phs.query(physicaljg);
    }
    @ResponseBody
    @RequestMapping("findPsychologyjg")
    public  List<Psychologyjg> findPsychologyjg(@RequestBody Psychologyjg psychologyjg){
        return ps.query(psychologyjg);
    }
    @ResponseBody
    @RequestMapping("findGyfa")
    public Gyfa findGyfa(@RequestBody Gyfa gyfa){
        return is.query(gyfa);
    }
    @ResponseBody
    @RequestMapping("findYdfa")
    public List<Ydfa> findYdfa(@RequestBody Ydfa ydfa){

        return is.query(ydfa);
    }
    @ResponseBody
    @RequestMapping("findYsfa")
    public List<Ysfa> findYsfa(@RequestBody Ysfa ysfa){
        return is.query(ysfa);
    }

    @ResponseBody
    @RequestMapping("findSetmeal")
    public List<Setmeal> findSetmeal(){
        return ss.findAll();
    }
}
